home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
051-060
/
amok56
/
m2maker
/
txt
/
timersupport.mod
< prev
next >
Wrap
Text File
|
1993-11-04
|
4KB
|
132 lines
(*---------------------------------------------------------------------------
:Program. m2Maker
:Author. Thomas Stolze
:Address. Goslarsche Str. 32, 3000 Hannover 21, Germany
:Phone. (0)511 / 75 10 77
:Version. V2.0
:Date. 13-Nov-90
:Copyright. Shareware
:Language. Modula-2
:Translator. M2Amiga V4.0d
:Contents. Programming Utility.
:Remark. Supports the M2Amiga System (C) by A+L AG Switzerland
:LastUpdate. 03-JUN-91
---------------------------------------------------------------------------*)
IMPLEMENTATION MODULE TimerSupport;
FROM Arts IMPORT Assert;
FROM Conversions IMPORT ValToStr;
FROM DosD IMPORT Date;
FROM DosL IMPORT DateStamp;
FROM DosL IMPORT Delay;
FROM DateConversions IMPORT DateInfo,DateToStr,FromDos,month3;
FROM ExecD IMPORT IOStdReq,IOStdReqPtr,MemReqs,MemReqSet,MsgPortPtr,
TaskPtr,LibraryPtr;
FROM ExecL IMPORT AvailMem,CloseDevice,DoIO,Forbid,
OpenDevice,Permit,Enable,Disable,OpenLibrary,
CloseLibrary;
FROM ExecSupport IMPORT CreateExtIO,CreatePort,CreateTask,DeleteExtIO,
DeletePort;
FROM GraphicsD IMPORT jam2,RastPortPtr;
FROM GraphicsL IMPORT Move,SetAPen,SetBPen,SetDrMd,Text;
FROM InitIntuition IMPORT prgPtr;
FROM IntuitionL IMPORT ActivateWindow;
FROM RequesterWindow IMPORT version;
FROM String IMPORT Concat,Length;
FROM SYSTEM IMPORT ADR,LONGSET;
FROM Timer IMPORT addRequest,IOTimer,IOTimerPtr,timerName,vBlank;
VAR msgTimerPort : MsgPortPtr;
adrIOTimer : IOTimerPtr;
task : TaskPtr;
exit : BOOLEAN;
PROCEDURE PrintHeadLine;
VAR headline : ARRAY [0..80] OF CHAR;
PROCEDURE MakeHeadLine(VAR str : ARRAY OF CHAR);
VAR date : Date;
info : DateInfo;
print: ARRAY [0..10] OF CHAR;
err : BOOLEAN;
mem : INTEGER;
PROCEDURE freeMemory(memory : MemReqSet): INTEGER;
VAR bytes : LONGINT;
BEGIN
bytes:=AvailMem(memory); RETURN bytes DIV 1024;
END freeMemory;
BEGIN
DateStamp(ADR(date)); FromDos(date,info);
DateToStr(info," %d.%t.%y %H:%M:%S ",month3,str);
mem:=freeMemory(MemReqSet{fast});
ValToStr(mem,FALSE,print,10,4," ",err);
Concat(str,' F:'); Concat(str,print); Concat(str,'K C:');
mem:=freeMemory(MemReqSet{chip});
ValToStr(mem,FALSE,print,10,4," ",err);
Concat(str,print); Concat(str,'K ');
END MakeHeadLine;
PROCEDURE Print(text : ARRAY OF CHAR;
rport : RastPortPtr;
fPen,bPen : INTEGER;
xpos,ypos : INTEGER);
BEGIN
SetAPen(rport,fPen); SetBPen(rport,bPen); SetDrMd(rport,jam2);
Move(rport,xpos,ypos); Text(rport,ADR(text),Length(text));
END Print;
BEGIN
Forbid();
headline:=(""); MakeHeadLine(headline);
Print(version ,prgPtr^.window^.rPort,3,1,30, 7);
IF prgPtr^.window^.width > 550 THEN
Print(headline,prgPtr^.window^.rPort,2,1,148,7);
END;
Permit();
END PrintHeadLine;
(*$LoadA4:=TRUE*)
PROCEDURE TimerTask;
BEGIN
msgTimerPort:=CreatePort(NIL,0);
IF msgTimerPort # NIL THEN
adrIOTimer:=CreateExtIO(msgTimerPort,SIZE(IOTimer));
OpenDevice(ADR(timerName),vBlank,adrIOTimer,LONGSET{});
exit:=FALSE;
REPEAT
adrIOTimer^.node.command:=addRequest;
adrIOTimer^.time.secs:=1;
adrIOTimer^.time.micro:=0;
DoIO(adrIOTimer);
PrintHeadLine;
UNTIL exit;
CloseDevice(adrIOTimer);
DeleteExtIO(adrIOTimer); adrIOTimer:=NIL;
DeletePort(msgTimerPort); msgTimerPort:=NIL;
END;
task:=NIL;
END TimerTask;
PROCEDURE InitTimer;
BEGIN
task:=NIL; task:=CreateTask(ADR("m2Maker_Timer"),1,ADR(TimerTask),2048);
END InitTimer;
BEGIN
InitTimer;
CLOSE
REPEAT exit:=TRUE; Delay(2) UNTIL task = NIL;
END TimerSupport.